import { createStore, createLogger } from 'vuex'
import createPersisted from 'vuex-persistedstate'
import user from './modules/user'
import cart from './modules/cart'
import category from './modules/category'
import getters from './getters'

// Vue2 => new Vuex.Store
// Vue3 => createStore
export default createStore({
  modules: {
    user,
    cart,
    category
  },
  getters,
  plugins: [
    createPersisted({
      key: '@_@',
      paths: ['user', 'cart']
    }),
    createLogger()
  ]
})
